//
//  ZBBRecomendCell.m
//  沙哈拉FM
//
//  Created by dllo on 15/11/6.
//  Copyright © 2015年 S1mpl3. All rights reserved.
//

#import "ZBBRecomendCell.h"
#import "FitHeader.h"
#import "UIImageView+WebCache.h"
@implementation ZBBRecomendCell

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self createView];
    }
    return self;
}


- (void)createView{
    
    
    if (_flag) {
        _coverPathImageView = [[UIImageView alloc]init];
         _coverPathImageView.backgroundColor = [UIColor redColor];
    }
    else
    {
        _coverPathImageView = [[UIImageView alloc]init];
        
        _coverPathImageView.backgroundColor = [UIColor redColor];
        [self addSubview:_coverPathImageView];
        
        _titleTopLabel = [[BaseLabel alloc]init];
        [_titleTopLabel setFontSize:18];
        //_titleTopLabel.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_titleTopLabel];
        
        _titleCenterLabel = [[BaseLabel alloc]init];
        [_titleCenterLabel setFontSize:16];
        //_titleCenterLabel.textColor = [UIColor lightGrayColor];
        //    _titleCenterLabel.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_titleCenterLabel];
        
        _playImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_playImageView];
        
        _fluxImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_fluxImageView];
        
        _moreImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_moreImageView];
        _titleBottomLeftLabel = [[BaseLabel alloc]init];
        [_titleBottomLeftLabel setFontSize:14];
        [self.contentView addSubview:_titleBottomLeftLabel];
        _titleBottomRightLabel = [[BaseLabel alloc]init];
        [_titleBottomRightLabel setFontSize:14];
        [self.contentView addSubview:_titleBottomRightLabel];

    }
   }
- (void)layoutSubviews{
    [super layoutSubviews];
    
    if (_flag) {
        _coverPathImageView.frame = CGRectMake(10 * FITWidth, 10 * FITHeight, 50* FITWidth, 50 * FITHeight);

    }
    else
    {
        _coverPathImageView.frame = CGRectMake(10 * FITWidth, 10 * FITHeight, 80 * FITWidth, 80 * FITHeight);
        _titleTopLabel.frame = CGRectMake(_coverPathImageView.frame.origin.x + _coverPathImageView.frame.size.width + 10 * FITWidth, _coverPathImageView.frame.origin.y + 5 * FITHeight, self.contentView.frame.size.width - _coverPathImageView.frame.size.width - 52 * FITWidth, 30 * FITHeight);
        _titleCenterLabel.frame = CGRectMake(_titleTopLabel.frame.origin.x, _titleTopLabel.frame.origin.y + _titleTopLabel.frame.size.height, _titleTopLabel.frame.size.width, 25 * FITHeight);
        _moreImageView.frame = CGRectMake(_titleCenterLabel.frame.origin.x + _titleCenterLabel.frame.size.width, 40 * FITHeight, 22 * FITHeight, 22 * FITHeight);
        _moreImageView.image = [UIImage imageNamed:@"S1mpl3更多"];
        _titleBottomLeftLabel.frame = CGRectMake(_titleCenterLabel.frame.origin.x + 8 * FITWidth, _titleCenterLabel.frame.origin.y + _titleCenterLabel.frame.size.height, 70 * FITWidth, 20 * FITHeight);
        
        _titleBottomRightLabel.frame = CGRectMake(_titleBottomLeftLabel.frame.origin.x + 8 * FITWidth + _titleBottomLeftLabel.frame.size.width, _titleBottomLeftLabel.frame.origin.y, 70 * FITWidth, 20 * FITHeight);
        
        _playImageView.frame = CGRectMake(_titleTopLabel.frame.origin.x, _titleBottomLeftLabel.frame.origin.y + 6 * FITHeight, 8 * FITWidth, 8 * FITHeight);
        _playImageView.image = [UIImage imageNamed:@"S1mpl3播放"];
        
        _fluxImageView.frame = CGRectMake(_titleBottomLeftLabel.frame.origin.x+ _titleBottomLeftLabel.frame.size.width, _playImageView.frame.origin.y, 8 * FITWidth, 8 * FITHeight);
        _fluxImageView.image = [UIImage imageNamed:@"iconfont-jishu"];
    }
   
}
-(void)setModel:(S1mpl3MoreRecommend *)model
{
    
    [_coverPathImageView sd_setImageWithURL:[NSURL URLWithString:model.albumCoverUrl290]];
    NSLog(@"%@", model.albumCoverUrl290);
    
    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
